Node2D plugin example

This example shows how to create a custom 2D node and render video frames with Kanzi using that node. The example shows how to use the Kanzi Engine plugins. For Android, a shared image texture utilizing OES_EGL_image_external extension is used for streaming the video from an external context.

You can find the example in <KanziWorkspace>/Examples/Node2D_plugin.

The example plugin creates the VideoView2D node. For details on how to create a Kanzi Engine plugin, see Node3D plugin example.

The example runs on Windows and Android platforms:

Note To run the Node2D plugin example on Windows 10 N and Windows 10 KN versions, you must install the Media feature pack provided by Microsoft.

Using the external texture handle

Because Android’s native code and Kanzi application framework run in different context, they cannot share the GPU resources. A widely available OpenGL extension (GL_TEXTURE_EXTERNAL_OES) provides the support for external texture resources that can be shared between contexts with few limitations. The Node2D_plugin example uses the Android media player to render a video stream to a surface view that is bound to the external texture handle. On the Kanzi side, the texture of the node that renders the video is bound to the same external texture handle, and displayed in the render loop.

You can use this approach on other platforms where:

A typical example is a streaming video.

Building the plugin .dll

Kanzi Studio Preview uses the .dll file of the plugin to run the example code.

To build the plugin .dll that the example uses:

  1. In Visual Studio 2010 open the solution for the example <KanziWorkspace>/Examples/Node2D_plugin/Application/configs/platforms/win32.
  2. In Visual Studio select the GL_vs2010_Debug_DLL solution configuration.
  3. Build the Node2D_plugin_executable application.
    When Visual Studio completes the building, it places the plugin .dll to <KanziWorkspace>/Examples/Node2D_plugin/Application/output/win32/GL_vs2010_Debug_DLL.
  4. Copy the <KanziWorkspace>/Examples/Node2D_plugin/Application/output/win32/GL_vs2010_Debug_DLL/Node2D_plugin.dll to <KanziWorkspace>/Examples/Node2D_plugin/Application/bin.
    This is the location where the Node2D_plugin example Kanzi Studio project is configured to look for the plugin.
  5. Make sure that the solution configuration you used in Visual Studio to build your application and plugin projects matches the settings of your Kanzi Studio project.
    For example, if you used the GL_vs2010_Debug solution in Visual Studio, in your Kanzi Studio project in the Project > Properties set:

  6. In Kanzi Studio start the Preview. When the Preview starts, it loads the plugin .dll you built and you can interact in the Preview with the custom components defined in the application code.

See also

Kanzi Engine plugins

Examples